#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QtCore>
#include <QMutex>
#include <QMessageBox>
#include <QtNetwork>
#include "smallwindow.h"

struct User
{
    QString username;
    QStringList permittedToSee;
};

namespace Ui {
    class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();





public slots:
    //Network SLOTS

    //GUI SLOTS
    void on_Welcome_SignIn_clicked();

    void on_Client_Send_clicked();
    void on_Client_SignOut_clicked();

    void on_Management_Send_clicked();
    void on_Management_SignOut_clicked();
    void on_Management_Add_clicked();
    void on_Management_Remove_clicked();
    void on_Management_Edit_clicked();

    void on_Permissions_DenyAll_clicked();
    void on_Permissions_DenyOne_clicked();
    void on_Permissions_PermitAll_clicked();
    void on_Permissions_PermitOne_clicked();
    void on_Permissions_Save_clicked();

    void Receive_Message();
    void SSL_Error(QList<QSslError> errors);
signals:

private:
    Ui::MainWindow *ui;

    //private members
    QString username;
    QString password;
    QString serverIP;
    quint64 port;

    bool superadmin;

    QList<User> usersList;
    QStringList messages;
    QString editing;

    QSslSocket *secureSocket;
    QString currentmsg;
    quint16 blockSize;


    //private functions
    void Send_Message(QString message);

    void Update_Client();
    void Update_Management();
    void Update_Editor();

    //test population functions
    bool Validate_Credentials();
    void Populate_Client();
    void Populate_Management();
};

#endif // MAINWINDOW_H
